package org.lq.sm.view.employee;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class V_EmpMain extends JFrame {

	private JPanel contentPane;
	private JTable table;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					V_EmpMain frame = new V_EmpMain();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public V_EmpMain() {
		setTitle("员工资料管理");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 723, 493);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JScrollPane scrollPane = new JScrollPane();
		contentPane.add(scrollPane, BorderLayout.CENTER);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{"1", "\u65E0\u8BED", "13603738558", "33333", "0.5", "2020-05-09", "\u663E\u5F97"},
			},
			new String[] {
				"\u5DE5\u53F7", "\u59D3\u540D", "\u7535\u8BDD", "\u5E95\u85AA", "\u63D0\u6210\u6BD4\u4F8B", "\u5165\u804C\u65E5\u671F", "\u5907\u6CE8"
			}
		));
		scrollPane.setViewportView(table);
		
		JPanel panel = new JPanel();
		FlowLayout flowLayout = (FlowLayout) panel.getLayout();
		flowLayout.setHgap(20);
		flowLayout.setAlignment(FlowLayout.RIGHT);
		contentPane.add(panel, BorderLayout.SOUTH);
		
		JButton btn_add = new JButton("增加");
		btn_add.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				V_empAdd add = new V_empAdd();
				add.setBounds(V_EmpMain.this.getX()+100, V_EmpMain.this.getY(), add.getWidth(), add.getHeight());
				add.setVisible(true);
			}
		});
		btn_add.setIcon(new ImageIcon(V_EmpMain.class.getResource("/images/add.png")));
		panel.add(btn_add);
		
		JButton btn_update = new JButton("修改");
		btn_update.setIcon(new ImageIcon(V_EmpMain.class.getResource("/images/modify.png")));
		panel.add(btn_update);
		
		JButton btn_delete = new JButton("删除");
		btn_delete.setIcon(new ImageIcon(V_EmpMain.class.getResource("/images/delete.png")));
		panel.add(btn_delete);
	}

}
